import {
    Document
} from "mongoose"
import {Prop, Schema, SchemaFactory} from "@nestjs/mongoose";
import {UserActions} from "../../../common/enums/userActions";

export type UserActionDocument = Action & Document

/* 用户历史行为 （针对图书）*/
@Schema({timestamps:{createdAt:true,updatedAt:false}})
export class Action extends Document {
    @Prop({required: true})
    userId: string

    @Prop({required: true})
    action: UserActions

    @Prop({required: true})
    bookId: string
}

export const UserActionSchema = SchemaFactory.createForClass(Action)

